package com.qmyx.supply.admin.controller;

import com.ytjj.qmyx.supplychain.common.api.CommonResult;
import com.ytjj.qmyx.supplychain.common.model.request.LinkErpRequest;
import com.ytjj.qmyx.supplychain.common.model.response.LinkErpResponse;
import com.ytjj.qmyx.supplychain.mapper.entity.LinkErp;
import com.ytjj.qmyx.supplychain.service.LinkErpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 */
@RestController
@RequestMapping("/yxLinkErp")
public class YxLinkErpController {
    @Autowired
    private LinkErpService linkErpService;

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public CommonResult info(@PathVariable("id") Integer id){
        LinkErpResponse linkErp = linkErpService.getByBankId(id);
        return CommonResult.success(linkErp);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public CommonResult save(@RequestBody LinkErpRequest linkErp) throws Exception{
        linkErpService.saveOrUpdate(linkErp);
        return CommonResult.success();
    }

    /**
     * 修改状态
     */
    @RequestMapping("/updateStatus")
    public CommonResult updateStatus(@RequestParam Integer id, @RequestParam Integer status){
        linkErpService.updateStatus(id,status);
        return CommonResult.success();
    }



}
